/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class FactoryDAO {
    private static EntityManagerFactory factory=Persistence.createEntityManagerFactory("agendaPU");
    public FactoryDAO(){
        
    }

    public static EntityManagerFactory getFactory() {
        return factory;
    }

    public static void setPersistenceFactory(String persistence) {
      if (persistence!=null && factory.isOpen()){
          factory.close();
      }
      factory=Persistence.createEntityManagerFactory(persistence);
    }
    
    
}
